package com.lcx.plugin.neteaseCloud.component.toolwindow.login.email;

import com.lcx.plugin.neteaseCloud.component.toolwindow.login.AbstractDialogWrapper;
import com.lcx.plugin.neteaseCloud.music.DataCenter;
import com.lcx.plugin.neteaseCloud.music.UserInfo;

import java.io.IOException;

/**
 * @author wengyongcheng
 * @since 2020/3/2 10:36 下午
 */
public class EmailPwdDialogWrapper extends AbstractDialogWrapper {

    public EmailPwdDialogWrapper() {
        textField.setText("");
    }

    @Override
    public String getHead() {
        return "登录 (3/3)";
    }

    @Override
    public boolean isPassword() {
        return true;
    }

    @Override
    public String getInfoMsg() {
        return "请输入密码";
    }

    @Override
    public String getBottomMsg() {
        return "请输入密码(按\"Enter\"以确认输入或按\"Esc\"以取消)";
    }

    @Override
    public void nextStep(String text) {
        DataCenter.accountPassword = text;
        // 登录动作
        UserInfo.loginByEmail();
        // 刷新面板
        try {
            DataCenter.mainPanel.setMyPanel();
            DataCenter.mainPanel.setMusicListPanel();
        } catch (IOException exception) {
            exception.printStackTrace();
        }
    }

}
